package com.ynwa.jvm;

/**
 * @author gzd
 * @date 2018-08-15 下午 3:23
 * @desc 新生代GC
 * 运行时，jvm参数：-verbose:gc -Xms20m -Xmx20m -Xmn10m(分给新生代10m) -XX:+PrintGCDetails(发生GC时打印日志)
 * -XX:SurvivorRatio=8(新生代的eden区和Survivor(from&to)的比例是8:1:1)
 */
public class MinorGCTest {

    private static final int _1M = 1024 * 1024;

    public static void main(String[] args) {
        byte[] allocation1, allocation2, allocation3, allocation4;

        allocation1 = new byte[2 * _1M];
        allocation2 = new byte[2 * _1M];
        allocation3 = new byte[2 * _1M];
        allocation4 = new byte[4 * _1M]; // 出现一次Minor GC ？
    }
}
